package com.cssnj.portal.service.query;

import com.cssnj.portal.domain.common.UserInfo;
import com.cssnj.portal.utils.PortalUntil;
import io.predictech.framework.domain.common.JsonRequest;
import io.predictech.framework.domain.common.JsonResponse;
import io.predictech.framework.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Arthur
 * @version 1.0
 * @description 税款缴纳情况 当月应入库税款、当月已入库税款、当月未入库税款	分地区柱状图  CX_SKJNQK
 * @since 2018-10-16 16:33
 */
@Service
public class Query09Service extends BaseService {

    @Autowired
    @Qualifier("fourthJdbcTemplate")
    private JdbcTemplate fourthJdbcTemplate;

    @Override
    protected JsonResponse invokingService(JsonRequest jsonRequest) {
        return null;
    }


    /**
     * @description 初始化柱图
     * @author Arthur
     * @since 2018-10-16 16:34
     **/
    @SuppressWarnings("SqlDialectInspection")
    public JsonResponse init(JsonRequest jsonRequest) {
        JsonResponse jsonResponse = new JsonResponse();
        UserInfo userInfo = (UserInfo) jsonRequest.getReqData().get("userInfo");
        List<Map<String, Object>> invokeList = fourthJdbcTemplate.queryForList("SELECT T.DQ_MC, T.YRK_JE, T.YIRK_JE, T.WRK_JE FROM CX_SKJNQK T WHERE T.SWJG_DM = ? ORDER BY T.DQ_DM DESC", userInfo.getCxjgDm());
        PortalUntil.castListMap2MapList(jsonResponse.getRepData(), invokeList);
        PortalUntil.castMapList2JSON(jsonResponse.getRepData());
        jsonResponse.getRepData().put("sfJgjcDm",userInfo.getSfJgjcDm());
        return jsonResponse;
    }
}
